package com.changil.admin.action.board;

import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.changil.admin.action.Action;
import com.changil.admin.dto.ArticleList;
import com.changil.admin.protocol.ArticleManager;
import com.changil.admin.protocol.http.HttpUtil;

public class ModifyFormAction extends Action {
	private int boardId;

	public ModifyFormAction(int boardId) {
		this.boardId = boardId;
	}

	@Override
	public void execute(HttpServletRequest request, HttpServletResponse response)
			throws IOException, ServletException {
		try {
			int articleId = Integer.valueOf(request.getParameter("articleId"));
			ArticleList list = ArticleManager.getsInstance().getArticleList(boardId, articleId+1, 1, true);
			request.setAttribute("article", list.list.get(0));
			HttpUtil.forward(request, response, "/views/board/modifyform.jsp");
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}
